const Generator = require('yeoman-generator')
module.exports = class extends Generator {
    propmting() {
        return this.prompt([
            {
                type: 'input',
                name: 'name',
                message: 'your project name',
                default: this.appname
            }
        ]).then((answers) => {
            this.answers = answers
        })
    }
    writing() {
        // templates中文件的相对路径
        const pathArr = [
            'babel.config.js',
            'package.json',
            'README.md',
            'src/main.js',
            'src/App.vue',
            'src/components/HelloWorld.vue',
            'src/assets/logo.png',
            'public/index.html'
        ]
        pathArr.forEach((item) => {
            this.fs.copyTpl(this.templatePath(item), this.destinationPath(item), this.answers)
        })
    }
}